/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package local;

import entity.Admins;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Emanuel
 */
@Stateless
public class AdminsFacade implements AdminsFacadeLocal {
    @PersistenceContext
    private EntityManager em;

    public void create(Admins admins) {
        em.persist(admins);
    }

    public void edit(Admins admins) {
        em.merge(admins);
    }

    public void remove(Admins admins) {
        em.remove(em.merge(admins));
    }

    public Admins find(Object id) {
        return em.find(Admins.class, id);
    }

    public List<Admins> findAll() {
        return em.createQuery("select object(o) from Admins as o").getResultList();
    }

}
